//
//  CDRecommendModel.swift
//  CDLiftWithDisplay
//
//  Created by SteveLi on 2017/9/18.
//  Copyright © 2017年 李军桦. All rights reserved.
//

import UIKit

class CDRecommendModel: NSObject {
    var detailImage:String?
    var logoImage:String?
    var intro: String?
    
    //重载构造函数
    init(dict:[String:Any]){
        super.init()
        setValuesForKeys(dict)
    }
    
    //将数据文件转换为模型数组
    //方法前加上class修饰关键字，表示当前方法为类方法
    class func recommendInfos() -> [CDRecommendModel] {
        guard let fileP  = Bundle.main.path(forAuxiliaryExecutable: "recommend.plist"),
            let dictArr = NSArray(contentsOfFile: fileP) else {
                return []
        }
        //创建可变数组
        var modelArray = [CDRecommendModel]()
        for dict in dictArr {
            let model = CDRecommendModel(dict: dict as! [String:Any])
            modelArray.append(model)
        }
        return modelArray
        
    }
    
}
